﻿package _Pan3D.core {

	
// --------------MSN:lation_pan@live.cn  QQ: 3423526------------- //

	public class Mathclass {
		
		
		public static function math_angle(x1:Number, y1:Number, x2:Number, y2:Number):Number {
			var d_x:Number = x1-x2;
			var d_y:Number = y1-y2;
			var z:Number = Math.atan(d_y/d_x)*180/3.1415926;
			if (d_x>=0 && d_y>=0) {
				z = z;
			}
			if (d_x<0 && d_y>0) {
				z = z+180;
			}
			if (d_x<0 && d_y<0) {
				z = z+180;
			}
			if (d_x>0 && d_y<0) {
				z = 360+z;
			}
			return z;
		}
		public static function math_distance(x1:Number, y1:Number, x2:Number, y2:Number):Number {
			var z :Number= Math.sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
			return z;
		}
		public static function math_distance3D(x1:Number, y1:Number, z1:Number, x2:Number, y2:Number, z2:Number):Number {
			var z :Number= Math.sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1) + (z2-z1)*(z2-z1));
			return z;
		}
		public static function getSourcePro(vSourceXml:XML):Array{
			var tempArray:Array=new Array;
			for (var i:int=0; i < vSourceXml.children().length(); i++) {
				var z:Object=new Object;
				for (var j:int=0; j < vSourceXml.child(i).children().length(); j++) {
					var vT:String=String(vSourceXml.child(i).child(j).name());
					z[vT]=vSourceXml.child(i).child(j);
				}
				tempArray[i]=z;
			}
			return tempArray;
		}

	


	}
}
